<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emacps: xemacps_example.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emacps
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xemacps__example_8h.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xemacps_example.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>Defines common data types, prototypes, and includes the proper headers for use with the EMACPS example code residing in this directory. </p>
<p>This file along with <a class="el" href="xemacps__example__util_8c.html" title="This file implements the utility functions for the XEmacPs example code. ">xemacps_example_util.c</a> are utilized with the specific example code in the other source code files provided. These examples are designed to be compiled and utilized within the SDK standalone BSP development environment.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
<hr/>

1.00a wsy  01/10/10 First release
1.01a asa  02/27/12 Hash define added for EMACPS_SLCR_DIV_MASK.
1.05a asa  09/22/13 The EthernetFrame is made cache line aligned (32 bytes).
                                  Fix for CR #663885.
3.0   hk   02/20/15 Increase array sizes to add support for jumbo frames.
3.2   mus  02//16 Added support support to INTC controller
3.3   kpc  12/09/16 Fixed issue when -O2 is enabled
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0bc7c575f2858a89f9496f83dc6052d4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a0bc7c575f2858a89f9496f83dc6052d4">EmacPsUtilFrameHdrFormatMAC</a> (EthernetFrame *FramePtr, char *DestAddr)</td></tr>
<tr class="memdesc:a0bc7c575f2858a89f9496f83dc6052d4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the MAC addresses in the frame.  <a href="#a0bc7c575f2858a89f9496f83dc6052d4">More...</a><br /></td></tr>
<tr class="separator:a0bc7c575f2858a89f9496f83dc6052d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6fddc02339ce2adea5260e2401572eb8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a6fddc02339ce2adea5260e2401572eb8">EmacPsUtilFrameHdrFormatType</a> (EthernetFrame *FramePtr, u16 FrameType)</td></tr>
<tr class="memdesc:a6fddc02339ce2adea5260e2401572eb8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the frame type for the specified frame.  <a href="#a6fddc02339ce2adea5260e2401572eb8">More...</a><br /></td></tr>
<tr class="separator:a6fddc02339ce2adea5260e2401572eb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a745c2dd310df9fc6a3067ec7c426d9b5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a745c2dd310df9fc6a3067ec7c426d9b5">EmacPsUtilFrameSetPayloadData</a> (EthernetFrame *FramePtr, u32 PayloadSize)</td></tr>
<tr class="memdesc:a745c2dd310df9fc6a3067ec7c426d9b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function places a pattern in the payload section of a frame.  <a href="#a745c2dd310df9fc6a3067ec7c426d9b5">More...</a><br /></td></tr>
<tr class="separator:a745c2dd310df9fc6a3067ec7c426d9b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9bf345bfd8b6008fd32c436c1c8f049e"><td class="memItemLeft" align="right" valign="top">LONG&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a9bf345bfd8b6008fd32c436c1c8f049e">EmacPsUtilFrameVerify</a> (EthernetFrame *CheckFrame, EthernetFrame *ActualFrame)</td></tr>
<tr class="memdesc:a9bf345bfd8b6008fd32c436c1c8f049e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function verifies the frame data against a CheckFrame.  <a href="#a9bf345bfd8b6008fd32c436c1c8f049e">More...</a><br /></td></tr>
<tr class="separator:a9bf345bfd8b6008fd32c436c1c8f049e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af60ff561f93957fc82d6625103a3ec5c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#af60ff561f93957fc82d6625103a3ec5c">EmacPsUtilFrameMemClear</a> (EthernetFrame *FramePtr)</td></tr>
<tr class="memdesc:af60ff561f93957fc82d6625103a3ec5c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function sets all bytes of a frame to 0.  <a href="#af60ff561f93957fc82d6625103a3ec5c">More...</a><br /></td></tr>
<tr class="separator:af60ff561f93957fc82d6625103a3ec5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a115c0926c08893ef3e71c68f7622576a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a115c0926c08893ef3e71c68f7622576a">EmacPsUtilstrncpy</a> (char *Destination, const char *Source, u32 n)</td></tr>
<tr class="memdesc:a115c0926c08893ef3e71c68f7622576a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function copys data from source to desitnation for n bytes.  <a href="#a115c0926c08893ef3e71c68f7622576a">More...</a><br /></td></tr>
<tr class="separator:a115c0926c08893ef3e71c68f7622576a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a776b1bc0336021ef0b3542c13ba81e83"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a776b1bc0336021ef0b3542c13ba81e83">EmacPsUtilErrorTrap</a> (const char *Message)</td></tr>
<tr class="memdesc:a776b1bc0336021ef0b3542c13ba81e83"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is called by example code when an error is detected.  <a href="#a776b1bc0336021ef0b3542c13ba81e83">More...</a><br /></td></tr>
<tr class="separator:a776b1bc0336021ef0b3542c13ba81e83"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a907ad3930dc1eefe5a53a0b82b715091"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemacps__example_8h.html#a907ad3930dc1eefe5a53a0b82b715091">EmacpsDelay</a> (u32 delay)</td></tr>
<tr class="memdesc:a907ad3930dc1eefe5a53a0b82b715091"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function provides delays in seconds.  <a href="#a907ad3930dc1eefe5a53a0b82b715091">More...</a><br /></td></tr>
<tr class="separator:a907ad3930dc1eefe5a53a0b82b715091"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a907ad3930dc1eefe5a53a0b82b715091"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a907ad3930dc1eefe5a53a0b82b715091">&#9670;&nbsp;</a></span>EmacpsDelay()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacpsDelay </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>delay</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function provides delays in seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Delay</td><td>in seconds</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>for microblaze the delay is not accurate and it need to tuned. </dd></dl>

</div>
</div>
<a id="a776b1bc0336021ef0b3542c13ba81e83"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a776b1bc0336021ef0b3542c13ba81e83">&#9670;&nbsp;</a></span>EmacPsUtilErrorTrap()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilErrorTrap </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>Message</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is called by example code when an error is detected. </p>
<p>It can be set as a breakpoint with a debugger or it can be used to print out the given message if there is a UART or STDIO device.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Message</td><td>is the text explaining the error</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

</div>
</div>
<a id="a0bc7c575f2858a89f9496f83dc6052d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bc7c575f2858a89f9496f83dc6052d4">&#9670;&nbsp;</a></span>EmacPsUtilFrameHdrFormatMAC()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilFrameHdrFormatMAC </td>
          <td>(</td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>FramePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>DestAddr</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the MAC addresses in the frame. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">FramePtr</td><td>is the pointer to the frame. </td></tr>
    <tr><td class="paramname">DestAddr</td><td>is the Destination MAC address.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a6fddc02339ce2adea5260e2401572eb8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6fddc02339ce2adea5260e2401572eb8">&#9670;&nbsp;</a></span>EmacPsUtilFrameHdrFormatType()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilFrameHdrFormatType </td>
          <td>(</td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>FramePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>FrameType</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set the frame type for the specified frame. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">FramePtr</td><td>is the pointer to the frame. </td></tr>
    <tr><td class="paramname">FrameType</td><td>is the Type to set in frame.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="af60ff561f93957fc82d6625103a3ec5c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af60ff561f93957fc82d6625103a3ec5c">&#9670;&nbsp;</a></span>EmacPsUtilFrameMemClear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilFrameMemClear </td>
          <td>(</td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>FramePtr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function sets all bytes of a frame to 0. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">FramePtr</td><td>is a pointer to the frame itself.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a745c2dd310df9fc6a3067ec7c426d9b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a745c2dd310df9fc6a3067ec7c426d9b5">&#9670;&nbsp;</a></span>EmacPsUtilFrameSetPayloadData()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilFrameSetPayloadData </td>
          <td>(</td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>FramePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>PayloadSize</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function places a pattern in the payload section of a frame. </p>
<p>The pattern is a 8 bit incrementing series of numbers starting with 0. Once the pattern reaches 256, then the pattern changes to a 16 bit incrementing pattern: </p><pre>
  0, 1, 2, ... 254, 255, 00, 00, 00, 01, 00, 02, ...
</pre><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">FramePtr</td><td>is a pointer to the frame to change. </td></tr>
    <tr><td class="paramname">PayloadSize</td><td>is the number of bytes in the payload that will be set.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a9bf345bfd8b6008fd32c436c1c8f049e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9bf345bfd8b6008fd32c436c1c8f049e">&#9670;&nbsp;</a></span>EmacPsUtilFrameVerify()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LONG EmacPsUtilFrameVerify </td>
          <td>(</td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>CheckFrame</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">EthernetFrame *&#160;</td>
          <td class="paramname"><em>ActualFrame</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function verifies the frame data against a CheckFrame. </p>
<p>Validation occurs by comparing the ActualFrame to the header of the CheckFrame. If the headers match, then the payload of ActualFrame is verified for the same pattern Util_FrameSetPayloadData() generates.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CheckFrame</td><td>is a pointer to a frame containing the 14 byte header that should be present in the ActualFrame parameter. </td></tr>
    <tr><td class="paramname">ActualFrame</td><td>is a pointer to a frame to validate.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, else XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a115c0926c08893ef3e71c68f7622576a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a115c0926c08893ef3e71c68f7622576a">&#9670;&nbsp;</a></span>EmacPsUtilstrncpy()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void EmacPsUtilstrncpy </td>
          <td>(</td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>Destination</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>Source</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function copys data from source to desitnation for n bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Destination</td><td>is the targeted string to copy to. </td></tr>
    <tr><td class="paramname">Source</td><td>is the source string to copy from. </td></tr>
    <tr><td class="paramname">n</td><td>is number of bytes to be copied.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function is similiar to strncpy(), however strncpy will stop either at null byte or n bytes is been copied. This function will copy n bytes without checking the content. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
